package com.hmdp.config.RabbitMQ.service;


import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//发送消息
@Service
public class RabbirService {

    @Autowired
    private RabbitTemplate rabbitTemlate;


    /**
     *
     * @param exchange  交换机
     * @param routingKey  队列名字key
     * @param message   消息也就是消息实体。
     * @return
     */

    public  boolean sendMessage(String exchange,String routingKey,Object message){
        rabbitTemlate.convertAndSend(exchange,routingKey,message);
        return true;
    }

}
